<!doctype html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>课窝后台登录</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <link rel="stylesheet" href="./css/style.css">
</head>

<body>
    <div class="x-body">
        <div class="layui-row">
            <form class="layui-form layui-col-md12 x-so">
                <div class="layui-input-inline">
                    <select name="contrller" lay-filter="yx">
                    <option>按客户意向查询</option>
                    <option value="gj">按留学国家查询</option>
                    <option value="lb">按语言类别查询</option>
                </select>
                </div>
                <div class="layui-input-inline yx1 ">
                    <select name="111" id="yxdown">
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="contrller">
                    <option value="">按渠道类型查询</option>
                    <option value="0">SEO网站</option>
                    <option value="1">新媒体</option>
                    <option value="2">同业合作</option>
                    <option value="3">广告竞价</option>
                    <option value="4">个人</option>
                    <option value="5">其他</option>
                </select>
                </div>
                <div class="layui-input-inline">
                    <select name="contrller">
                    <option value="">按状态查询</option>
                    <option value="0">已签约</option>
                    <option value="1">马上签约</option>
                    <option value="2">就是不签约</option>
                </select>
                </div>
                <button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
            </form>
        </div>
        <xblock>
            <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量恢复</button>
            <span class="x-right" style="line-height:40px">共有数据：88 条</span>
        </xblock>


        <table class="layui-table">
            <thead>
                <tr>
                    <th>
                        <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
                    </th>
                    <th lay-data="{field:'id', sort: true}">客户姓名</th>
                    <th>客户意向</th>
                    <th>留学国家/语言类别</th>
                    <th>渠道类型</th>
                    <th>渠道详情</th>
                    <th>创建人</th>
                    <th>负责人</th>
                    <th>状态</th>
                    <th class="collate">删除时间 <img src="images/排序.png" alt=""></th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='1'><i class="layui-icon">&#xe605;</i>
                        </div>
                    </td>
                    <td class="ee">王宝强</td>
                    <td>留学</td>
                    <td>法国</td>
                    <td>个人</td>
                    <td>www.lvmaozi.com</td>
                    <td>马蓉</td>
                    <td>宋哲</td>
                    <td>未分配</td>
                    <td>2017-09-21</td>
                    <td class="td-manage">
                        <a title="查看" onclick="x_admin_show('查看','Essential information.html')" href="javascript:;">
                            <i class="layui-icon">&#xe63c;</i>
                        </a>
                        <a title="恢复" onclick="member_del(this,'要恢复的id')" href="javascript:;">
                            <img src="images/恢复.png" alt="" class="recoverimg">
                        </a>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='1'><i class="layui-icon">&#xe605;</i>
                        </div>
                    </td>
                    <td class="ee">郭德纲</td>
                    <td>留学</td>
                    <td>法国</td>
                    <td>个人</td>
                    <td>www.lvmaozi.com</td>
                    <td>马蓉</td>
                    <td>宋哲</td>
                    <td>未分配</td>
                    <td>2017-09-1</td>
                    <td class="td-manage">
                        <a title="查看" onclick="x_admin_show('查看','Essential information.html')" href="javascript:;">
                            <i class="layui-icon">&#xe63c;</i>
                        </a>
                        <a title="恢复" onclick="member_del(this,'要恢复的id')" href="javascript:;">
                            <img src="images/恢复.png" alt="" class="recoverimg">
                        </a>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='1'><i class="layui-icon">&#xe605;</i>
                        </div>
                    </td>
                    <td class="ee">刘能</td>
                    <td>留学</td>
                    <td>法国</td>
                    <td>个人</td>
                    <td>www.lvmaozi.com</td>
                    <td>马蓉</td>
                    <td>宋哲</td>
                    <td>未分配</td>
                    <td>2017-09-25</td>
                    <td class="td-manage">
                        <a title="查看" onclick="x_admin_show('查看','Essential information.html')" href="javascript:;">
                            <i class="layui-icon">&#xe63c;</i>
                        </a>
                        <a title="恢复" onclick="member_del(this,'要恢复的id')" href="javascript:;">
                            <img src="images/恢复.png" alt="" class="recoverimg">
                        </a>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='1'><i class="layui-icon">&#xe605;</i>
                        </div>
                    </td>
                    <td class="ee">王大</td>
                    <td>留学</td>
                    <td>法国</td>
                    <td>个人</td>
                    <td>www.lvmaozi.com</td>
                    <td>马蓉</td>
                    <td>宋哲</td>
                    <td>未分配</td>
                    <td>2017-09-22</td>
                    <td class="td-manage">
                        <a title="查看" onclick="x_admin_show('查看','Essential information.html')" href="javascript:;">
                            <i class="layui-icon">&#xe63c;</i>
                        </a>
                        <a title="恢复" onclick="member_del(this,'要恢复的id')" href="javascript:;">
                            <img src="images/恢复.png" alt="" class="recoverimg">
                        </a>
                    </td>
                </tr>
            </tbody>
        </table>
        <div class="page">
            <div>
                <a class="prev" href="">&lt;&lt;</a>
                <a class="num" href="">1</a>
                <span class="current">2</span>
                <a class="num" href="">3</a>
                <a class="num" href="">99</a>
                <a class="next" href="">&gt;&gt;</a>
            </div>
        </div>

    </div>


    <script type="text/javascript" src="./js/jquery-3.2.1.min.js"></script>
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <script>
        layui.use(['layer', 'form'], function() {
            var layer = layui.layer,
                form = layui.form;
            form.on('select(yx)', function(data) {
                var sec = data.value;
                var add;
                if (sec == "gj") {
                    add = new Array("英国", "法国", "埃塞俄比亚", "朝鲜")
                } else if (sec == "lb") {
                    add = new Array("英语", "日语", "法语", "普通话")
                }
                $("#yxdown").length = 0;
                $("#yxdown>option").remove();
                for (var i = 0; i < add.length; i++) {
                    var ss = new Option();
                    ss.text = add[i].split()[0];
                    $("#yxdown").append(ss);
                    form.render('select');
                }
            })
        })
    </script>

    <script>
        $(".collate>img").on("click", function() {
            makeSortable();
        })

        // 点击进行table排列
        function makeSortable(table) {
            var headers = table.getElementsByTagName("th");
            for (var i = 0; i < headers.length; i++) {
                (function(n) {
                    var flag = false;
                    headers[n].onclick = function() {
                        var tbody = table.tBodies[0]; 
                        var rows = tbody.getElementsByTagName("tr");
                        rows = Array.prototype.slice.call(rows, 0); 

                        rows.sort(function(row1, row2) {
                            var cell1 = row1.getElementsByTagName("td")[n]; 
                            var cell2 = row2.getElementsByTagName("td")[n];
                            var val1 = cell1.textContent || cell1.innerText; 
                            var val2 = cell2.textContent || cell2.innerText;

                            if (val1 < val2) {
                                return -1;
                            } else if (val1 > val2) {
                                return 1;
                            } else {
                                return 0;
                            }
                        });
                        if (flag) {
                            rows.reverse();
                        }
                        for (var i = 0; i < rows.length; i++) {
                            tbody.appendChild(rows[i]);
                        }

                        flag = !flag;
                    }
                }(i));
            }
        }

        window.onload = function() {
            var table = document.getElementsByTagName("table")[0];
            makeSortable(table);
        }
    </script>
    <script>
        layui.use('laydate', function() {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
            });
        });

        /*用户-停用*/


        /*用户-删除*/
        function member_del(obj, id) {
            var data = $(obj).parent().parent().find(".ee").html();
            console.log(data)
            layer.confirm('确认要恢复' + data + '吗？', {
                title: '确认删除'
            }, function(index) {
                //发异步删除数据
                $(obj).parents("tr").remove();
                layer.msg('已恢复!', {
                    icon: 1,
                    time: 1000
                });
            });
        }

        function delAll(argument) {

            var data = tableCheck.getData();

            layer.confirm('确认要恢复吗？', function(index) {
                //捉到所有被选中的，发异步进行删除
                layer.msg('恢复成功', {
                    icon: 1
                });
                $(".layui-form-checked").not('.header').parents('tr').remove();
            });
        }
    </script>
    <script>
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
</body>

</html>